﻿<UserControl x:Class="SPIWareMVVM.Views.MaterialEdit"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:me="clr-namespace:SPIWareMVVM.ViewModels" 
             xmlns:converters="clr-namespace:SPIWareMVVM.Views.Conversions"
             xmlns:rules="clr-namespace:SPIWareMVVM.Views.ValidationRules"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ObjectDataProvider x:Key="materialsVM" ObjectType="{x:Type me:MaterialsViewModel}"/>
        <ObjectDataProvider x:Key="applicationData" ObjectType="{x:Type me:ApplicationData}"/>
        <converters:OpCostPerPartConverter x:Key="opCostPerPartConverter" />
        <converters:BoxesPerPalletConverter x:Key="boxesPerPalletConverter"/>
        <converters:DyeCostPerPartConverter x:Key="dyeCostPerPartConverter"/>
        <converters:MoldSetupCostConverter x:Key="moldSetupCostConverter"/>
        <converters:NaturalResinConverter x:Key="naturalResinConverter"/>
        <converters:ResinDyePricePerPartConverter x:Key="resinDyePricePerPartConverter"/>
        <converters:StartupScrapPriceConverter x:Key="startupScrapPriceConverter"/>
        <converters:PartsPerHour_ASConverter x:Key="partsPerHour_ASConverter"/>
        <converters:TTLPackagingPiecePerPartConverter x:Key="ttlPackagingPiecePerPartConverter"/>
        <converters:TTLCostPrePartMaterialPackagingConverter x:Key="ttlCostPrePartMaterialPackagingConverter"/>
        <converters:LaborSecondPerPartConverter x:Key="laborSecondPerPartConverter"/>
        <converters:LaborTTLPerPartConverter x:Key="laborTTLPerPartConverter"/>
        <converters:OverheadFactorConverter x:Key="overheadFactorConverter"/>
        <converters:CostStartPressConverter x:Key="costStartPressConverter"/>
        <converters:TTLPrePartMaterialPackagingLaborConverter x:Key="ttlPrePartMaterialPackagingLaborConverter"/>
        <converters:TTLCostPartAverageConverter x:Key="ttlCostPartAverageConverter"/>
        <converters:TTLCostRunTargetConverter x:Key="ttlCostRunTargetConverter"/>
        <converters:TTLCostAvgCycleTimeConverter x:Key="ttlCostAvgCycleTimeConverter"/>
        <converters:AfterSetupRunTargetConverter x:Key="afterSetupRunTargetConverter"/>
        <converters:AfterSetupAvgCycleTimeConverter x:Key="afterSetupAvgCycleTimeConverter"/>
        <converters:AfterMaterialsRunTargetConverter x:Key="afterMaterialsRunTargetConverter"/>
        <converters:AfterMaterialsAvgCycleTimeConverter x:Key="afterMaterialsAvgCycleTimeConverter"/>
    </UserControl.Resources>
    <StackPanel Orientation="Vertical">
        <TextBlock Text="Part Information" VerticalAlignment="Center" FontStyle="Italic" Margin="4" FontSize="12"/>
        <StackPanel x:Name="Header" Orientation="Horizontal">
            <TextBlock Text="Part Number: "/>
            <TextBox >
                <TextBox.Text>
                    <Binding Path="PartNumber">
                        <Binding.ValidationRules>
                            <rules:EmptyStringRule/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Text="Description: "/>
            <TextBox Text="{Binding Description}"/>
            <TextBlock Text="Price"/>
            <TextBox >
                <TextBox.Text>
                    <Binding Path="Price">
                        <Binding.ValidationRules>
                            <rules:EmptyStringRule/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
        </StackPanel>

        <Expander x:Name="expPress" Header="Machine Presses">
            <Grid IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="1" Grid.Row="0" Text="Press Machine: "/>
                <TextBlock Grid.Column="1" Grid.Row="1" Text="Press Size: "/>
                <TextBlock Grid.Column="1" Grid.Row="2" Text="Press Rate: "/>
                <TextBlock Grid.Column="1" Grid.Row="4" Text="Operating Cost: "/>
                <TextBlock Grid.Column="1" Grid.Row="5" Text="Op Cost Per Part: "/>

                <ComboBox Grid.Column="2" Grid.Row="0" x:Name="cboMachinePress" SelectionChanged="PressChanged"
                              DisplayMemberPath="{Binding Path=PressNumber}"
                              SelectedValuePath="{Binding Path=PressId}"
                              SelectedValue="{Binding Path=SelectedItem.PressId}"
                              ItemsSource="{Binding Path=ocMachinePresses}" />
                <TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding PressSize}"/>
                <TextBlock Grid.Column="2" Grid.Row="2" Text="{Binding PressRate}"/>
                <TextBlock Grid.Column="2" Grid.Row="4" Text="{Binding PressOpCost}"/>
                <TextBlock Grid.Column="2" Grid.Row="5" x:Name="opCostPerPart">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource opCostPerPartConverter}">
                            <Binding Path="PressOpCost"/>
                            <Binding Path="Text" ElementName="partsPerHour_AS"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </Grid>
        </Expander>
        <Expander x:Name="expMaterials" Header="Materials">
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <ComboBox x:Name="cboMaterialTypes" SelectionChanged="TypeChanged" 
                              DisplayMemberPath="{Binding Path=MaterialType1}"
                              SelectedValuePath="{Binding Path=MaterialTypeId}"
                              SelectedValue="{Binding Path=SelectedItem.MaterialTypeId}"
                              ItemsSource="{Binding Path=ocMaterialTypes}"/>
                    <TextBlock Width="24"/>
                    <TextBlock Text="{Binding MaterialType.MaterialType1}"/>
                    <TextBlock Width="24"/>
                    <TextBlock Text="{Binding MaterialType.MaterialVendor}"/>
                </StackPanel>
                <Grid IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="45"/>      
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Material Type: "/>
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="Other Materials: "/>
                    <TextBlock Grid.Column="1" Grid.Row="2" Text="Drawing Number: "/>
                    <TextBlock Grid.Column="1" Grid.Row="3" Text="Revision: "/>
                    <TextBlock Grid.Column="1" Grid.Row="4" Height="24"/>
                    <!-- -->
                    <TextBlock Grid.Column="1" Grid.Row="6" Text="Part Weight: "/>
                    <TextBlock Grid.Column="1" Grid.Row="7" Text="Parts Per Shot: "/>
                    <TextBlock Grid.Column="1" Grid.Row="8" Text="Shot Weight: "/>

                    <TextBox Grid.Column="2" Grid.Row="0" Text="{Binding MaterialType.MaterialType1}"/>
                    <TextBox Grid.Column="2" Grid.Row="1" Text="{Binding OtherMaterials}"/>
                    <TextBox Grid.Column="2" Grid.Row="2" Text="{Binding DrawingNumber}"/>
                    <TextBox Grid.Column="2" Grid.Row="3" Text="{Binding DrawingRevision}"/>
                    <!-- -->
                    <TextBox Grid.Column="2" Grid.Row="6" >
                        <TextBox.Text>
                            <Binding Path="PartWeight">
                                <Binding.ValidationRules>
                                    <rules:EmptyStringRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <TextBox Grid.Column="2" Grid.Row="7" >
                        <TextBox.Text>
                            <Binding Path="PartsPerShot">
                                <Binding.ValidationRules>
                                    <rules:EmptyStringRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <TextBox Grid.Column="2" Grid.Row="8" Text="{Binding ShotWeight}"/>
                    <!-- SprueWeight ??? -->

                    <TextBlock Grid.Column="3" Grid.Row="0" Text="Cost Per LB: "/>
                    <TextBlock Grid.Column="3" Grid.Row="1" Text="Material Cost: "/>
                    <TextBlock Grid.Column="3" Grid.Row="7" Text="Parts Per Hour: "/>
                    <TextBlock Grid.Column="3" Grid.Row="8" Text="Target Cycle Time: "/>

                    <TextBox Grid.Column="4" Grid.Row="0" Text="{Binding MaterialType.CostPerLB}"/>
                    <TextBox Grid.Column="4" Grid.Row="1" >
                        <TextBox.Text>
                            <Binding Path="MaterialCost">
                                <Binding.ValidationRules>
                                    <rules:EmptyStringRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <TextBox Grid.Column="4" Grid.Row="7" Text="{Binding PartsPerHour}"/>
                    <TextBox Grid.Column="4" Grid.Row="8" Text="{Binding TargetCycleTime}"/>

                    <TextBlock Grid.Column="5" Grid.Row="6" Text="Average Cycle Time: "/>
                    <TextBlock Grid.Column="5" Grid.Row="7" Text="Parts Per Hour: "/>

                    <TextBlock Grid.Column="6" Grid.Row="5" Text="After Scrap"/>
                    <TextBox Grid.Column="6" Grid.Row="6" >
                        <TextBox.Text>
                            <Binding Path="AverageCycleTime_AS">
                                <Binding.ValidationRules>
                                    <rules:EmptyStringRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <TextBlock Grid.Column="6" Grid.Row="7" x:Name="partsPerHour_AS">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource partsPerHour_ASConverter}">
                            <Binding Path="AverageCycleTime_AS"/>
                            <Binding Path="PartsPerShot"/>
                        </MultiBinding>
                    </TextBlock.Text>
                    </TextBlock>
                </Grid>
                <TextBlock Height="24"/>
                <StackPanel Orientation="Horizontal" IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                    <TextBlock Text="Dye #"/>
                    <TextBox Text="{Binding DyeNumber}"/>
                    <TextBlock Text="Natural Resin: "/>
                    <TextBlock x:Name="naturalResin">
                        <TextBlock.Text>
                            <MultiBinding Converter="{StaticResource naturalResinConverter}">
                                <Binding Path="MaterialType.CostPerLB"/>
                                <Binding Path="PartWeight"/>
                            </MultiBinding>
                        </TextBlock.Text>
                    </TextBlock>
                    <TextBlock Text="Vendor: "/>
                    <TextBox Text="{Binding DyeVendor}"/>
                    <TextBlock Text="Dye Mix Ratio: "/>
                    <TextBox >
                        <TextBox.Text>
                            <Binding Path="DyeMixRatio">
                                <Binding.ValidationRules>
                                    <rules:EmptyStringRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                </StackPanel>
                <Grid IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="45"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="1" Grid.Row="0" Text="Dye Cost / LB: "/>
                    <TextBlock Grid.Column="1" Grid.Row="1" Text="Dye Cost / Part: "/>
                    <TextBlock Grid.Column="1" Grid.Row="2" Text="Resin Dye Price / Part: "/>

                    <TextBox Grid.Column="2" Grid.Row="0" >
                        <TextBox.Text>
                            <Binding Path="DyeCostPerLB">
                                <Binding.ValidationRules>
                                    <rules:EmptyStringRule/>
                                </Binding.ValidationRules>
                            </Binding>
                        </TextBox.Text>
                    </TextBox>
                    <TextBlock Grid.Column="2" Grid.Row="1" x:Name="dyeCostPerPart">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource dyeCostPerPartConverter}">
                            <Binding Path="PartWeight"/>
                            <Binding Path="DyeMixRatio"/>
                            <Binding Path="DyeCostPerLB"/>
                        </MultiBinding>
                    </TextBlock.Text>
                    </TextBlock>
                    <TextBlock Grid.Column="2" Grid.Row="2" x:Name="resinDyePricePerPart">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource resinDyePricePerPartConverter}">
                            <Binding Path="PartWeight"/>
                            <Binding Path="DyeMixRatio"/>
                            <Binding Path="DyeCostPerLB"/>
                            <Binding Path="MaterialType.CostPerLB"/>
                        </MultiBinding>
                    </TextBlock.Text>
                    </TextBlock>
                </Grid>
            </StackPanel>
        </Expander>
        <Expander x:Name="expBoxes" Header="Boxes">
            <Grid IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="1" Grid.Row="0" Text="Packaging / Part: "/>
                <TextBlock Grid.Column="1" Grid.Row="1" Text="Box Size: "/>
                <TextBlock Grid.Column="1" Grid.Row="2" Text="Box Price: "/>
                <TextBlock Grid.Column="1" Grid.Row="3" Text="Parts / Box: "/>
                <TextBlock Grid.Column="1" Grid.Row="4" Text="Boxes / Pallet: "/>
                <TextBlock Grid.Column="1" Grid.Row="5" Text="Parts / Pallet: "/>
                <TextBlock Grid.Column="1" Grid.Row="6" Text="Price / Box"/>
                <TextBlock Grid.Column="1" Grid.Row="7" Text="AQ41Price: "/>
                <TextBlock Grid.Column="1" Grid.Row="8" Text="Other Packaging: "/>

                <TextBox Grid.Column="2" Grid.Row="0" Text="{Binding PackagingPerPart}"/>
                <TextBox Grid.Column="2" Grid.Row="1" Text="{Binding BoxSize}"/>
                <TextBox Grid.Column="2" Grid.Row="2"  >
                    <TextBox.Text>
                        <Binding Path="BoxPrice">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Grid.Column="2" Grid.Row="3" >
                    <TextBox.Text>
                        <Binding Path="PartsPerBox">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBlock Grid.Column="2" Grid.Row="4" x:Name="boxesPerPallet">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource boxesPerPalletConverter}">
                            <Binding Path="PartsPerPallet"/>
                            <Binding Path="PartsPerBox"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBox Grid.Column="2" Grid.Row="5" >
                    <TextBox.Text>
                        <Binding Path="PartsPerPallet">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Grid.Column="2" Grid.Row="6" >
                    <TextBox.Text>
                        <Binding Path="PricePerBox">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Grid.Column="2" Grid.Row="7" >
                    <TextBox.Text>
                        <Binding Path="AQ41Price">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Grid.Column="2" Grid.Row="8" Text="{Binding OtherPackaging}"/>
            </Grid>
        </Expander>
        <Expander x:Name="expMolding" Header="Molding">
            <Grid IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="1" Grid.Row="0" Text="Startup Scrap: "/>
                <TextBlock Grid.Column="1" Grid.Row="1" Text="Startup Scrap Price: "/>
                <TextBlock Grid.Column="1" Grid.Row="2" Text="Mold Number: "/>
                <TextBlock Grid.Column="1" Grid.Row="3" Text="Mold Setup Time: "/>
                <TextBlock Grid.Column="1" Grid.Row="4" Text="Mold Setup Cost: "/>

                <TextBox Grid.Column="2" Grid.Row="0" >
                    <TextBox.Text>
                        <Binding Path="StartupScrap">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBlock Grid.Column="2" Grid.Row="1" x:Name="startupScrapPrice">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource startupScrapPriceConverter}">
                            <Binding Path="StartupScrap"/>
                            <Binding Path="DyeMixRatio"/>
                            <Binding Path="DyeCostPerLB"/>
                            <Binding Path="MaterialType.CostPerLB"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBox Grid.Column="2" Grid.Row="2" Text="{Binding MoldNumber}"/>
                <TextBox Grid.Column="2" Grid.Row="3" >
                    <TextBox.Text>
                        <Binding Path="MoldSetupTime">
                            <Binding.ValidationRules>
                                <rules:EmptyStringRule/>
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBlock Grid.Column="2" Grid.Row="4" x:Name="moldSetupCost">
                    <TextBlock.Text>
                    <MultiBinding Converter="{StaticResource moldSetupCostConverter}">
                        <Binding Path="MoldSetupTime"/>
                    </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </Grid>
        </Expander>
        <Expander x:Name="expTotals" Header="Totals">
            <Grid IsEnabled="{Binding SelectedItem.IsEditable, ElementName=lbWorkOrders}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="45"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Column="1" Grid.Row="0" Text="Packaging Piece / Part: "/>
                <TextBlock Grid.Column="1" Grid.Row="1" Text="Labor Second / Part: "/>
                <TextBlock Grid.Column="1" Grid.Row="2" Text="Labor Total / Part: "/>
                <TextBlock Grid.Column="1" Grid.Row="3" Text="Total Cost Run Target: "/>
                <TextBlock Grid.Column="1" Grid.Row="4" Text="After Materials Run Target: "/>
                <TextBlock Grid.Column="1" Grid.Row="5" Text="After Setup Run Target: "/>
                <TextBlock Grid.Column="1" Grid.Row="6" Text="Cost Start Press: "/>
                <TextBlock Grid.Column="1" Grid.Row="7" Text="Cost Pre-Part Material Packaging: "/>
                <TextBlock Grid.Column="1" Grid.Row="8" Text="Cost Pre-Part with Labor: "/>
                <TextBlock Grid.Column="1" Grid.Row="9" Text="Part Average: "/>
                <TextBlock Grid.Column="1" Grid.Row="10" Text="After Setup Average Cycle Time: "/>
                <TextBlock Grid.Column="1" Grid.Row="11" Text="After Materials Average Cycle Time: "/>
                <TextBlock Grid.Column="1" Grid.Row="12" Text="Total Cost Average Cycle Time: "/>
                <TextBlock Grid.Column="1" Grid.Row="13" Text="Overhead Factor: "/>

                <TextBlock Grid.Column="2" Grid.Row="0" x:Name="ttlPackagingPiecePerPart">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource ttlPackagingPiecePerPartConverter}">
                            <Binding Path="BoxPrice"/>
                            <Binding Path="PartsPerBox"/>
                            <Binding Path="PartsPerPallet"/>
                            <Binding Path="AQ41Price"/>
                            <Binding Path="PricePerBox"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="1" x:Name="laborSecondPerPart">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource laborSecondPerPartConverter}">
                            <Binding Path="AverageCycleTime_AS"/>
                            <Binding Path="PartsPerShot"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="2" x:Name="laborTTLPerPart">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource laborTTLPerPartConverter}">
                            <Binding Path="Text" ElementName="laborSecondPerPart"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="3" x:Name="ttlCostRunTarget">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource ttlCostRunTargetConverter}">
                            <Binding Path="Price"/>
                            <Binding Path="Text" ElementName="ttlCostPartAverage"/>
                            <Binding Path="PartsPerHour"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="4" x:Name="afterMaterialsRunTarget">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource afterMaterialsRunTargetConverter}">
                            <Binding Path="Price"/>
                            <Binding Path="Text" ElementName="ttlCostPrePartMaterialPackaging"/>
                            <Binding Path="PartsPerHour"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="5" x:Name="afterSetupRunTarget">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource afterSetupRunTargetConverter}">
                            <Binding Path="Price"/>
                            <Binding Path="Text" ElementName="ttlCostPartAverage"/>
                            <Binding Path="Text" ElementName="laborTTLPerPart"/>
                            <Binding Path="Text" ElementName="opCostPerPart"/>
                            <Binding Path="PartsPerHour"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="6" x:Name="costStartPress">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource costStartPressConverter}">
                            <Binding Path="Text" ElementName="moldSetupCost"/>
                            <Binding Path="Text" ElementName="startupScrapPrice"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="7" x:Name="ttlCostPrePartMaterialPackaging">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource ttlCostPrePartMaterialPackagingConverter}">
                            <Binding Path="Text" ElementName="resinDyePricePerPart"/>
                            <Binding Path="MaterialCost"/>
                            <Binding Path="Text" ElementName="ttlPackagingPiecePerPart"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="8" x:Name="ttlPrePartMaterialPackagingLabor">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource ttlPrePartMaterialPackagingLaborConverter}">
                            <Binding Path="Text" ElementName="opCostPerPart"/>
                            <Binding Path="Text" ElementName="ttlCostPrePartMaterialPackaging"/>
                            <Binding Path="Text" ElementName="laborTTLPerPart"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="9" x:Name="ttlCostPartAverage">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource ttlCostPartAverageConverter}">
                            <Binding Path="Text" ElementName="costStartPress"/>
                            <Binding Path="Text" ElementName="ttlPrePartMaterialPackagingLabor"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="10" x:Name="afterSetupAvgCycleTime">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource afterSetupAvgCycleTimeConverter}">
                            <Binding Path="Price"/>
                            <Binding Path="Text" ElementName="ttlCostPartAverage"/>
                            <Binding Path="Text" ElementName="laborTTLPerPart"/>
                            <Binding Path="Text" ElementName="opCostPerPart"/>
                            <Binding Path="Text" ElementName="partsPerHour_AS"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="11" x:Name="afterMaterialsAvgCycleTime">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource afterMaterialsAvgCycleTimeConverter}">
                            <Binding Path="Price"/>
                            <Binding Path="Text" ElementName="ttlCostPrePartMaterialPackaging"/>
                            <Binding Path="Text" ElementName="partsPerHour_AS"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="12" x:Name="ttlCostAvgCycleTime">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource ttlCostAvgCycleTimeConverter}">
                            <Binding Path="Price"/>
                            <Binding Path="Text" ElementName="ttlCostPartAverage"/>
                            <Binding Path="Text" ElementName="partsPerHour_AS"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
                <TextBlock Grid.Column="2" Grid.Row="13" x:Name="overheadFactor">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource overheadFactorConverter}">
                            <Binding Path="PartsPerShot"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </Grid>
        </Expander>
    </StackPanel>
</UserControl>
